<?php
namespace app\service;
use Webman\RedisQueue\Client;
use Webman\RedisQueue\Redis;

class RedisQueueService{

    public static function publish($queue,$data,$sync=false): bool
    {
        if ($sync){
            Redis::send($queue, $data);
        }else{
            Client::send($queue, $data);
        }
        return true;
    }

    public static function publishDelay($queue,$data,$delay=1,$sync=false): bool
    {
        if ($sync){
            Redis::send($queue, $data,$delay);
        }else{
            Client::send($queue, $data, $delay);
        }
        return true;
    }

}